//
// Created by Apple on 2021/10/15.
//

#ifndef EXERCISE_CPP_ERROTEST_H
#define EXERCISE_CPP_ERROTEST_H

# include <system_error>

namespace twt
{
    enum class FlightsErrc
    {
        // no 0
        NonexistentLocations = 10, // requested airport doesn't exist
        DatesInThePast,            // booking flight for yesterday
        InvertedDates,             // returning before departure
        NoFlightsFound       = 20, // did not find any combination
        ProtocolViolation    = 30, // e.g., bad XML
        ConnectionError,           // could not connect to server
        ResourceError,             // service run short of resources
        Timeout,                   // did not respond in time
    };

std::error_code make_error_code(FlightsErrc);
}


namespace std
{
template <>
struct is_error_code_enum<twt::FlightsErrc> : true_type {};
}





#endif //EXERCISE_CPP_ERROTEST_H
